//
//  iGesture.h
//  iGesture
//
//  Created by Tai Le on 6/4/13.
//  Copyright (c) 2013 kms. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol iSwipeGestureDelegate;

@interface iSwipeGesture : UIPanGestureRecognizer
{
    CGFloat _preTouchX;
    CGFloat _initialX;
    CGFloat _preTouchY;
    CGFloat _initialY;
}
@property (nonatomic,weak) id<iSwipeGestureDelegate> swipeDelegate;
@property (nonatomic) CGFloat anchorLeftCenter;//default _view.bounds.size.width/2
@property (nonatomic) CGFloat anchorRightCenter;//default _view.bounds.size.width*1.5
@property (nonatomic) CGFloat anchorBottomCenter;//default _view.bounds.size.height/2
@property (nonatomic) CGFloat anchorTopCenter;//default _view.bounds.size.height*1.5
@property (nonatomic) BOOL isAnchorLeft;

-(id) initSwipeLR;
-(id) initSwipeLRWithAnchorLeftCenter:(CGFloat) anchorLeft;
-(id) initSwipeLRWithAnchorRightCenter:(CGFloat) anchorRight;
-(id) initSwipeLRWithAnchorLeftCenter:(CGFloat) anchorLeft anchorRightCenter:(CGFloat) anchorRight;

-(id) initSwipeUD;
-(id) initSwipeUDWithAnchorTopCenter:(CGFloat) anchorTop;
-(id) initSwipeUDWithAnchorBottomCenter:(CGFloat) anchorBottom;
-(id) initSwipeUDWithAnchorTopCenter:(CGFloat) anchorTop anchorBottomCenter:(CGFloat) anchorBottom;

- (void)animationToLeft;
- (void)animationToRight;
@end

@protocol iSwipeGestureDelegate <NSObject>

@optional
- (void) iSwipeGestureDidAnchorLeft:(iSwipeGesture*) gesture;
- (void) iSwipeGestureDidAnchorRight:(iSwipeGesture*) gesture;
- (void) iSwipeGestureDidAnchorTop:(iSwipeGesture*) gesture;
- (void) iSwipeGestureDidAnchorBottom:(iSwipeGesture*) gesture;

@end
